#
# packet template
#
# Copyright (C) 2009 by chrisv
#          
# See CREDITS for details about who has contributed to this project.
#
# For further information about the pdaXrom project and license conditions
# see the README file.
#

SPU_TOOLS_VERSION=2.3.0.136
SPU_TOOLS=spu-tools-${SPU_TOOLS_VERSION}.tar.gz
SPU_TOOLS_MIRROR=http://switch.dl.sourceforge.net/sourceforge/libspe
SPU_TOOLS_DIR=$BUILD_DIR/spu-tools
SPU_TOOLS_ENV="$CROSS_ENV_AC"

build_spu_tools() {
    test -e "$STATE_DIR/spu_tools.installed" && return
    banner "Build spu-tools"
    download $SPU_TOOLS_MIRROR $SPU_TOOLS
    extract $SPU_TOOLS
    apply_patches $SPU_TOOLS_DIR spu-tools
    pushd $TOP_DIR
    cd $SPU_TOOLS_DIR/src
    make $MAKEARGS CC=${CROSS}gcc CFLAGS="-O2 -I$TARGET_INC -L$TARGET_LIB" || error

    $INSTALL -D -m 755 spu-ps $ROOTFS_DIR/usr/bin/spu-ps || error
    $INSTALL -D -m 755 spu-top $ROOTFS_DIR/usr/bin/spu-top || error
    $STRIP $ROOTFS_DIR/usr/bin/spu-ps || error
    $STRIP $ROOTFS_DIR/usr/bin/spu-top || error

    popd
    touch "$STATE_DIR/spu_tools.installed"
}

build_spu_tools
